var o = getApp();

Page({
    data: {
        store_id: "",
        qr_code: "",
        keyOn: !1
    },
    onLoad: function(o) {
        o.key ? this.setData({
            keyOn: !0
        }) : o.store_id && this.setData({
            store_id: o.store_id
        }), this.getCode();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    downLoad: function(o) {
        var t = [];
        t.push(this.data.qr_code), wx.previewImage({
            urls: t
        });
    },
    getCode: function() {
        var t, e = this;
        this.data.keyOn ? t = o.getNetAddresss("plugin.store-cashier.frontend.store.goods-buy.get-collection-code") : (t = o.getNetAddresss("plugin.store-cashier.frontend.store.goods-buy.goodsqrcode"), 
        t += "&id=" + this.data.store_id), o._getNetWork({
            url: t,
            success: function(o) {
                var t = o.data;
                1 == t.result ? e.setData({
                    qr_code: e.data.keyOn ? t.data : t.data.small_qrcode
                }) : wx.showToast({
                    icon: "none",
                    title: t.msg,
                    duration: 1500
                });
            },
            fail: function(o) {
                console.log(o);
            }
        });
    }
});